<!--Generate by Kevin's CodeBuilder -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
		<meta charset="UTF-8">
		<title>工作流管理系统</title>
		<head  th:replace="source::header"></head>
</head>
<body>
	<div class="form_main_wrap">
		<div class="form_condition" style="padding-top:10px" >
				<table class="k_form_table">
					<tr>
						<td class="label label100">[(${Lang.common_selectFile})]</td>
						<td >
							<div id="fileUpload3"></div>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="text-align: center;padding-top:20px;">
							<button class="k_icon_fff" id="submit_btn">
								<i class="fa fa-arrow-circle-up"></i>
								[(${Lang.common_btn_uploadData})]
							</button>
						</td>
					</tr>
				</table>	
				<p id="message" style="text-align:center;line-height:22px;padding-top:5px;"></p>
		</div>
	</div>
	<script type="text/javascript"  th:inline="javascript">
		$B.DomUtils.onDomLoaded(function(){

			var $msg = document.getElementById("message");
			var upload3 =  new $B.Upload("fileUpload3",{
				timeout: 600, //超时时间 秒
				url: $B.getHttpHost()+"func/import",
				multiple: false, //是否可批量选择
				fileParamName: 'attachments',
				immediate: false, //选择文件后是否立即自动上传，即不用用户点击提交按钮就上传
				accept: '.xls,.xlsx',   // 可上传的文件类型 .xml,.xls,.xlsx,.png
				onSelected: function(file,fileName){ //选择文件后的事件请返回true 以便通过验证
					console.log(fileName);
					$msg.innerHTML = "";
					return true;
				},
				success: function(mesage, data, res){ //成功时候的回调
					console.log("success "+mesage);
					$msg.innerHTML = mesage;
					setTimeout(()=>{
						parent.closeWindow();
					},1500);
				},
				onDeleted: function(res){//删除回调,function(res){ }
					$msg.innerHTML = "";
					console.log("delete "+res);
				},
				setParams: function(){ //设置参数 return {}
					return {};
				}
			});
			$B.DomUtils.click(document.getElementById("submit_btn"),function () {
				upload3.upload();
			});
		});
	</script>
</body>
</html>